#!/usr/bin/env python
# -*- coding: utf-8 -*-

from typing import Any

from cta.config.base_config import BaseConfig
from cta.interface.action.transaction_date.abstract_transaction_date_action import AbstractTransactionDateAction
from web.domain.responsibility_chain_dto import ResponsibilityChainDto
from web.manager.log_manager import LogManager

Logger = LogManager.get_logger(__name__)

class CommonTransactionDateAction(AbstractTransactionDateAction):
    """
    普通的交易日期动作
    """

    def exec(self, responsibility_chain_dto: ResponsibilityChainDto = None) -> Any:
        Logger.info("查询交易日，开始日期为[%s]，结束日期为[%s]", BaseConfig.Begin_Date, BaseConfig.End_Date)

        transaction_date_list: list = self.commodity_future_date_contract_data_dao.find_distinct_transaction_date_between_transaction_date_order_by_transaction_date(
            BaseConfig.Begin_Date, BaseConfig.End_Date)
        return [transaction_date_tuple[0] for transaction_date_tuple in transaction_date_list]

